/********************************************************************
	created:	2008/09/29
	created:	29:9:2008   17:15
	filename: 	h:\SimoneEngine\qianye\src\qylib\lex\qyLex.h
	author:		Xiong Jiayu
	copyright:  
	purpose:	
*********************************************************************/
#pragma once

#ifndef __QYLEX_H__
#define __QYLEX_H__

#include "../memsys/qyString.h"
#include "../math/qyMatrix4.h"
#include "../math/qyVector3.h"
#include "../math/qyAABB.h"
#include "../math/qyOBB.h"
#include "../math/qyColor.h"
#include "../math/qyQuat.h"
#include "../math/qyQuatT.h"
#include "../math/qyQuatTS.h"

#pragma warning( push )
	#pragma warning( disable : 4819 )
	#include <boost/tokenizer.hpp>
#pragma warning( pop )

typedef boost::char_separator<char>							qyTokenSep;
typedef boost::tokenizer<qyTokenSep>						qyTokenizer;
typedef qyTokenizer::iterator								qyTokenIterator;

typedef boost::char_separator<wchar_t>										qyTokenSepW;
typedef boost::tokenizer<qyTokenSepW, qyString::const_iterator, qyString>	qyTokenizerW;
typedef qyTokenizerW::iterator												qyTokenIteratorW;

void qyLex_GetInts( const int numInts, int *pData, qyTokenIterator &tok_it );
void qyLex_GetFloats( const int numFloats, float *pData, qyTokenIterator &tok_it );
int qyLex_GetNumNodeInToken( qyTokenizer &tokenizer );

void qyMatrix4_to_string( const Matrix4 &mat, qyString &text );
void qyMatrix4_from_string( Matrix4 &mat, const qyString &text );

void qyQuatTS_to_string( const QuatTS &qts, qyString &text );
void qyQuatTS_from_string( QuatTS &qts, const qyString &text );

#ifdef _WIN32
#include <tinyxml.h>
#else
#include <tinyxml/tinyxml.h>
#endif

void qyXml_SetAttribute( TiXmlElement *node, const char *name, const bool &value );
void qyXml_GetAttribute( TiXmlElement *node, const char *name, bool &value );
void qyXml_SetAttribute( TiXmlElement *node, const char *name, const int &value );
void qyXml_GetAttribute( TiXmlElement *node, const char *name, int &value );
void qyXml_SetAttribute( TiXmlElement *node, const char *name, const float &value );
void qyXml_GetAttribute( TiXmlElement *node, const char *name, float &value );
void qyXml_SetAttribute( TiXmlElement *node, const char *name, const Vector3 &value );
void qyXml_GetAttribute( TiXmlElement *node, const char *name, Vector3 &value );
void qyXml_SetAttribute( TiXmlElement *node, const char *name, const Vector4 &value );
void qyXml_GetAttribute( TiXmlElement *node, const char *name, Vector4 &value );
void qyXml_SetAttribute( TiXmlElement *node, const char *name, const qyColor &value );
void qyXml_GetAttribute( TiXmlElement *node, const char *name, qyColor &value );
void qyXml_SetAttribute( TiXmlElement *node, const char *name, const AABB &value );
void qyXml_GetAttribute( TiXmlElement *node, const char *name, AABB &value );
void qyXml_SetAttribute( TiXmlElement *node, const char *name, const Matrix4 &value );
void qyXml_GetAttribute( TiXmlElement *node, const char *name, Matrix4 &value );
void qyXml_SetAttribute( TiXmlElement *node, const char *name, const QuatTS &value );
void qyXml_GetAttribute( TiXmlElement *node, const char *name, QuatTS &value );

#endif
